using System.Collections.Generic;
using SG.Lang.Dry.Base;
using SG.Lang.Dry.Controlling;
using SG.Lang.Dry.Mirrors;

namespace SG.Lang.Dry.Code
{
    public abstract class ADT : Element
    {
        private readonly Namespace _namespace;

        private readonly IEnumerable<Field> _fields; 

        private readonly IEnumerable<Property> _properties;

        private readonly IEnumerable<Constructor> _constructors; 

        protected ADT(ref ElementRecord elementRecord, ref ADTRecord adtRecord)
            : base(ref elementRecord)
        {
            _namespace = adtRecord.Namespace.ResolveNamespace();
            _fields = adtRecord.FieldList.ResolveFields();
            _properties = adtRecord.PropertyList.ResolveProperties();
        }

        private Namespace Namespace { get { return _namespace; }}

        public IEnumerable<Field> Fields { get { return _fields; } } 

        public IEnumerable<Property> Properties { get { return _properties; } }
    }
}